package com.googlecode.javatools.classparser.impl;

import java.io.DataInput;
import java.io.IOException;

import com.googlecode.javatools.classparser.FileHeaderInfoParser;
import com.googlecode.javatools.classparser.types.FileHeaderInfo;
import com.googlecode.javatools.classparser.types.impl.FileHeaderInfoImpl;

public class FileHeaderInfoParserImpl implements FileHeaderInfoParser
{

	public FileHeaderInfo parse(final DataInput in) throws IOException
	{
		final int magic = in.readInt();
		final int minorVersion = in.readUnsignedShort();
		final int majorVersion = in.readUnsignedShort();
		final int constantPoolSize = in.readUnsignedShort();

		return new FileHeaderInfoImpl(magic, majorVersion, minorVersion, constantPoolSize);
	}
}
